package my.jieh.tips.io.file;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.io.File;

/**
 * <p>Title: Core Java Technologies Tech Tips</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: Blueimp</p>
 * @author jieh
 * @version 1.0
 */

// filter for gif/jpg/jpeg files
class ImageFileFilter extends FileFilter {
// return true if should accept a given file
  public boolean accept(File f) {
    if (f.isDirectory())
      return true;
    String path = f.getPath().toLowerCase();
    if (path.endsWith(".gif"))
      return true;
    if (path.endsWith(".jpg"))
      return true;
    if (path.endsWith(".jpeg"))
      return true;
    return false;
  }
// return a description of files
  public String getDescription() {
    return "Image file (*.gif,*.jpg,*.jpeg)";
  }
}
